# Contributor: Will Sinatra <wpsinatra@gmail.com>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=fennel
pkgver=0.4.2
pkgrel=0
pkgdesc="A Lua Lisp Language"
url="https://fennel-lang.org"
arch="all"
license="MIT"
source="fennel-$pkgver.tar.gz::https://github.com/bakpakin/Fennel/archive/$pkgver.tar.gz"
_lua_version=5.3
makedepends="lua5.3 lua5.3-dev lua5.3-libs"
builddir="$srcdir"/Fennel-$pkgver
subpackages="$pkgname-doc"

check() {
	make test LUA=lua5.3
}

build() {
	make fennel-bin LUA=lua5.3 STATIC_LUA_LIB=/usr/lib/liblua-5.3.so.0.0.0
}

package() {
	install -Dm644 "fennelview.lua" \
			-t "$pkgdir/usr/share/lua/$_lua_version/"

	install -Dm644 "fennelfriend.lua" \
			-t "$pkgdir/usr/share/lua/$_lua_version/"

	install -Dm644 "fennel.lua" \
			-t "$pkgdir/usr/share/lua/$_lua_version/"

	install -Dm644 "fennelbinary.fnl" \
			-t "$pkgdir/usr/share/lua/%_lua_version/"

	install -Dm644 "fennel.1" \
			-t "$pkgdir/usr/share/man/man1/fennel.1"

	install -Dm755 "fennel-bin" \
			"$pkgdir/usr/bin/fennel"
}

sha512sums="60cf0deb256c19d84662c9a42c39aa6ef7bc7033cc9acb96287572402cb06c500af6a9b5f600d75a74d54c0600b6adcb59a9f5f5973c598bf5e8ebbaf4dee872  fennel-0.4.2.tar.gz"
